package temp;

import java.io.BufferedReader;
import java.io.FileReader;

import utility.IdDict;

/** 
 * 
 * source_data "newComponentSets.txt"n
 * data_format [rearranged_userId][component_Id]
 * 
 * stat_data "compStat.txt"
 * data_format [component_Id][component_Size]
 * 1	1131712
 * 558727	2
 * 578923	2
 * 668073	3
 * 1039266	2
 * 
 * @author D
 * 
 */

public class getOutliers {

	/**
	 * @param args
	 * @throws Throwable 
	 */
	public static void main(String[] args) throws Throwable {
		
		String inPath = "/home/ddxu/data/newComponentSets.txt";
		String dictPath = "/home/ddxu/data/activeUsers.txt";
		String newDictPath = "/home/ddxu/data/activeUsers2.txt";
		
		String str;
		String[] tokens;
		int compSetId;
		
		IdDict antDict = new IdDict();
		antDict.loadAntiDict(dictPath);
		
		IdDict dict = new IdDict(1);
		dict.loadDict(dictPath);
		
		BufferedReader in = new BufferedReader(new FileReader(inPath));
		while((str = in.readLine()) != null) {
			tokens = str.split("\t");
			compSetId = Integer.parseInt(tokens[1]);
			if(compSetId != 1) {
				System.out.println(tokens[0]);
				System.out.println(antDict.dictValue(Integer.parseInt(tokens[0])));
				dict.rmRecord(antDict.dictValue(Integer.parseInt(tokens[0])));
			}
		}
		in.close();
		
		dict.writeDict(newDictPath);
		
	}

}
